(define invalid-tests 
  '(3
    (begin rax 5)
    (letrec () (set! rax 5))
    (letrec () (set! rax 5) (r15))
    (letrec () (begin (set! rax 5) (r15)))
    (letrec ([f$5 (lambda (rax)
                    (locals ()
                      (begin (r15))))])
      (locals () (f$5)))
    (letrec ([f$7 (lambda ()
                    (locals ()
                      (begin
                        (set! fv0 rdi)
                        (set! fv0 (+ fv0 10))
                        (set! rax fv0)
                        (r15 rax))))])
      (f$7 6))
    (letrec () (letrec () (begin (set! rax 5) (r15 rax))))
    (letrec (locals () (begin (set! rax 5) (r15 rax))))
    (letrec () (locals () (begin (set! rax 5.5) (r15 rax))))
    (letrec ([double$1 (lambda ()
                         (locals ()
                           (begin (set! rax (+ rax rax)) (r15))))]
             [triple$1 (lambda ()
                         (locals ()
                           (begin (set! rax (* rax 3)) (r15))))])
      (locals () (double$1)))
    (letrec ([foo (lambda ()
                    (locals () (begin (set! rax 5) (r15))))])
      (locals () (foo)))
    (letrec ([foo$0 (lambda ()
                      (locals ()
                        (begin (set! rax 5) (r15))))])
      (locals () (bar$1))) 
    (letrec ([test-double$1 (lambda ()
                              (locals ()
                                (begin
                                  (set! rdi 5)
                                  (double$2)
                                  (set! rax rdi)
                                  (r15))))]
             [double$2 (lambda ()
                         (locals ()
                           (begin (set! rdi (+ rdi rdi)) (r15))))])
      (locals () (test-double$1)))
    (letrec () (locals () (begin (set! x 5) (r15)))) 
    (letrec () (locals () (begin (set! rax 9223372036854775808) (r15))))
    (letrec () (locals () (begin (set! rax -9223372036854775809) (r15))))
    (letrec () 
      (locals () (begin (set! rax (+ rax 9223372036854775808)) (r15))))
    (letrec ()
      (locals () (begin (set! rax (+ rax -9223372036854775809)) (r15))))
    (letrec () (locals () (begin (set! fv0 12.5) (r15))))
    (letrec () (locals () (begin (set! rax (sra rax -1)) (r15))))
    (letrec () (locals () (begin (set! rax (sra rax 64)) (r15))))
    (letrec () (locals () (begin (set! rax (/ rax 5)) (r15))))
    (letrec ()
      (locals ()
        (begin (set! rax r15) (if (+ rcx 5) (rax) (r15)))))
    (letrec ()
      (locals ()
        (begin
          (set! rax 0)
          (if (= rax 0) (nop) (r15))
          (set! rax 5)
          (r15))))
    (letrec ()
      (locals ()
        (begin (if (begin (set! rax 10) (r15)) (r15) (r15)))))
    (letrec ()
      (locals ()
        (begin (if (begin (set! rax 10) (nop)) (r15) (r15)))))
    (letrec ()
      (locals ()
        (begin
          (if (begin (set! rax 10) (set! r11 10) (= rax r11))
              (set! rax 10)
              (r15)))))
    (letrec ()
      (locals ()
        (begin
          (set! rax 0)
          (if (if (= rax 0) (nop) (= rbx 0))
              (set! rax 10)
              (set! rbx 10))
          (r15))))
    (letrec ([main$0 (lambda ()
                       (locals ()
                         (begin
                           (set! rax r15)
                           (if (+ rcx 5) (rax) (r15)))))])
      (locals () (main$0)))
    (letrec ([main$0 (lambda ()
                       (locals ()
                         (begin
                           (set! rax 0)
                           (if (= rax 0) (nop) (r15))
                           (set! rax 5)
                           (r15))))])
      (locals () (main$0)))
    (letrec ([main$0 (lambda ()
                       (locals ()
                         (begin
                           (if (begin (set! rax 10) (nop))
                               (r15)
                               (r15)))))])
      (locals () (main$0)))
    (letrec ([main$0 (lambda ()
                       (locals ()
                         (begin
                           (if (begin
                                 (set! rax 10)
                                 (set! r11 10)
                                 (= rax r11))
                               (set! rax 10)
                               (r15)))))])
      (locals () (main$0)))
    (letrec ([main$0 (lambda ()
                       (locals ()
                         (if (= 0 rax) (f$0) (f$1))))]
             [f$0 (lambda ()
                    (locals () (begin (set! rax 5) (r15))))]
             [f$1 (lambda ()
                    (locals () (begin (set! rax 6) (r15))))])
      (locals () (main$0)))
    (letrec ()
      (locals () (if (= rax 9223372036854775808) (r15) (r15))))
    (letrec ()
      (locals ()
        (if (= fv0 -9223372036854775809) (r15) (r15))))
    (letrec ()
      (locals () (if (= fv0 12.5) (r15) (r15))))
    (letrec ()
      (locals ()
        (begin
          (set! rax 7)
          (if (if (< rax 10) (if (< rax 5) (false) (true)) #f)
              (begin (set! rax (* rax rax)) (r15))
              (r15)))))
    (letrec ()
      (locals ()
        (begin (set! x.5 (+ x.5 x.5)) (r15))))
    (letrec ()
      (locals (x z.5)
        (begin
          (set! x.1 5)
          (set! z.5 6)
          (set! z.5 (+ z.5 x.1))
          (set! rax z.5)
          (r15 rax))))
    (letrec ()
      (locals (x.1 y.2)
        (begin
          (set! x.1 5)
          (set! y.2 2)
          (set! z.5 (+ z.5 x.1))
          (set! z.5 (+ z.5 x.1))
          (set! rax z.5)
          (r15 rax))))
    (letrec ()
      (locals (x.1 y.2)
        (set! x.1 5)
        (r15 rax)))
    (letrec ()
      (locals (x.1 y.2 z.1)
        (begin
          (set! x.1 5)
          (set! y.2 rax)
          (set! z.1 (+ x.1 y.2))
          (set! rax z.1)
          (r15 rax))))
    (letrec ()
      (locals (x.1 y.2)
        (begin
          (set! x.1 (true))
          (if x.1 (set! y.2 5) (set! y.2 100))
          (set! rax y.2)
          (r15 rax))))
    (letrec ()
      (locals (x.1 y.2 acc.3)
        (begin
          (set! x.1 5)
          (set! y.2 0)
          (set! acc.3 0)
          loop$1
          (set! acc.3 (+ acc.3 x.1))
          (set! x.1 (- x.1 1))
          (if (= y.2 x.1) (nop) (loop$1))
          (set! rax acc.3)
          (r15 rax))))
    (letrec ([double$1 (lambda ()
                         (locals (x.3)
                           (begin
                             (set! x.3 fv0)
                             (set! x.3 (+ x.3 x.3))
                             (set! rax x.3)
                             (r15 rax))))])
      (locals (x.1 y.2 fv0)
        (begin
          (set! x.1 4)
          (set! y.2 0)
          (set! fv0 (+ x.1 y.2))
          (double$1 r15 rbp fv0))))
    (letrec ()
      (locals ()
        (begin (set! rax (sra rax 64)) (r15))))
    ))

(define tests 
  '((letrec () (locals () (begin (set! rax 5) (r15 rbp rax))))
    (letrec () 
      (locals (a.0 b.1)
        (begin
          (set! a.0 5)
          (set! b.1 6)
          (set! rax (+ a.0 b.1))
          (r15 rbp rax))))
    (letrec ()
      (locals (a.0)
        (begin
          (set! a.0 5)
          (set! a.0 (- 10 a.0))
          (set! rax a.0)
          (r15 rbp rax))))
    (letrec ([square$1 (lambda ()
                         (locals ()
                           (begin
                             (set! fv0 (* fv0 fv0))
                             (set! rax fv0)
                             (fv1 rbp rax))))])
      (locals ()
        (begin
          (set! fv0 10)
          (set! fv1 r15)
          (square$1 rax rbp fv0 fv1))))
    (letrec ()
      (locals ()
        (begin (set! rax 5) (set! rax (+ rax 5)) (r15 rbp rax))))
    (letrec ()
      (locals (x.1)
        (begin
          (set! rax 10)
          (set! x.1 rax)
          (set! rax (- rax x.1))
          (r15 rbp rax))))
     (letrec ()
       (locals (x.1)
         (begin (set! x.1 5) (set! rax x.1) (r15 rbp rax))))
     (letrec ()
       (locals (x.1)
         (begin
           (set! x.1 10)
           (set! rax -10)
           (set! rax (* rax x.1))
           (r15 rbp rax))))
     ;; test frame assignment early
     ;; here we use an artificially long list of live out registers
     ;; to force the register allocator to spill.
     (letrec ([f$1 (lambda ()
                     (locals (x.1 y.2 z.3)
                       (begin
                         (set! x.1 1)
                         (set! y.2 2)
                         (set! rax (+ x.1 y.2))
                         (r15 rax rcx rdx rbx rbp rdi rsi r8 r9 r10
                              r11 r12 r13 r14))))])
       (locals () (f$1 rbp r15)))
     (letrec ()
       (locals (x.1 y.2 z.3)
         (begin
           (set! x.1 1)
           (set! y.2 2)
           (set! z.3 3)
           (set! x.1 (+ x.1 y.2))
           (set! z.3 (+ z.3 y.2))
           (set! z.3 (+ x.1 z.3))
           (set! rax (+ x.1 z.3))
           (set! rax (+ rax y.2))
           (r15 rax rbp rbx rcx rdx rdi rsi r9 r10 r11 r12 r13 r14))))
     (letrec ()
       (locals (x.1 y.2 z.3 t.4)
          (begin
            (set! rax 5)
            (set! x.1 10)
            (set! y.2 rax)
            (set! z.3 4)
            (set! t.4 (+ y.2 z.3))
            (if (> t.4 x.1)
                (set! x.1 (+ rax t.4))
                (begin
                  (set! x.1 (+ x.1 z.3))
                  (set! z.3 (+ x.1 z.3))))
            (set! rax (+ x.1 z.3))
            (set! y.2 (* rax y.2))
            (set! rax (* t.4 y.2))
            (r15 rax rbp rbx rcx rdx rdi rsi r9 r10 r11 r12 r13 r14))))
     (letrec ()
       (locals (x.1 y.2 z.3 t.4 t.5)
         (begin
           (set! rax 5)
           (set! x.1 10)
           (set! y.2 20)
           (set! z.3 30)
           (set! t.4 (+ x.1 y.2))
           (if (begin (set! t.5 (+ x.1 z.3)) (= t.4 t.5))
               (set! t.4 (* z.3 y.2))
               (set! t.4 (+ z.3 x.1)))
           (set! rdx (+ t.5 t.4))
           (set! rbx (+ x.1 y.2))
           (set! rcx (+ z.3 t.5))
           (set! rax (+ rax rdx))
           (set! rax (+ rax rbx))
           (set! rax (+ rax rcx))
           (r15 rax rbp rbx rcx rdx rdi rsi r9 r10 r11 r12 r13 r14))))
     (letrec ()
       (locals (x.1 y.2 z.3 t.4 t.5)
         (begin
           (set! rax 5)
           (set! x.1 10)
           (set! y.2 20)
           (set! z.3 30)
           (if (if (begin 
                     (set! t.4 (+ x.1 y.2))
                     (set! t.5 (+ rax z.3)) 
                     (> t.4 t.5))
                   (< z.3 x.1)
                   (> z.3 y.2))
               (set! rax (+ t.4 t.5))
               (set! rax (- t.5 t.4)))
           (set! z.3 (+ x.1 y.2))
           (set! rax (* rax z.3))
           (r15 rax rbp rbx rcx rdx rdi rsi r9 r10 r11 r12 r13 r14))))
     (letrec ()
       (locals (x.1 y.2 z.3 t.4 t.5 w.6)
         (begin
           (set! rax 5)
           (set! x.1 10)
           (set! y.2 20)
           (set! z.3 30)
           (set! t.4 (+ x.1 y.2))
           (set! t.5 (+ rax z.3))
           (if (> t.5 t.4) (set! t.5 (- t.5 6)) (set! t.4 (+ t.4 z.3)))
           (set! w.6 (* t.5 t.4))
           (set! x.1 (+ w.6 z.3))
           (if (if (> y.2 x.1) (true) (< z.3 t.5))
               (set! rax (+ t.5 w.6))
               (begin
                 (set! rax (+ z.3 w.6))
                 (set! rax (- rax 6))))
           (set! x.1 (+ w.6 y.2))
           (set! rax (+ x.1 rax))
           (r15 rax rbp rbx rcx rdx rdi rsi r9 r10 r11 r12 r13 r14))))
     (letrec ()
       (locals (y.1)
         (begin
           (set! y.1 10)
           (set! y.1 (* y.1 -10))
           (set! rax y.1)
           (r15 rbp rax))))
     (letrec ()
       (locals ()
         (begin (set! rax 5) (set! rax (+ rax 10)) (r15 rbp rax))))
     (letrec ()
       (locals (z.1)
         (begin
           (set! z.1 5)
           (set! rax 10)
           (set! rax (+ rax z.1))
           (r15 rbp rax))))
     (letrec ()
       (locals ()
         (begin (set! rax 7) (set! rax (+ rax 4)) (r15 rbp rax))))
     (letrec ()
       (locals ()
         (begin (set! rax 7) (set! rax (- rax 4)) (r15 rbp rax))))
     (letrec ()
       (locals ()
         (begin (set! rax 7) (set! rax (* rax 4)) (r15 rbp rax))))
     (letrec ()
       (locals (a.1)
         (begin
           (set! rax 5)
           (set! a.1 -11)
           (set! rax (+ rax a.1))
           (r15 rbp rax))))
     (letrec ()
       (locals (a.1)
         (begin
           (set! rax 5)
           (set! a.1 -11)
           (set! rax (- rax a.1))
           (r15 rbp rax))))
     (letrec ()
       (locals (b.1)
         (begin
           (set! rax 5)
           (set! b.1 -11)
           (set! rax (* rax b.1))
           (r15 rbp rax))))
     (letrec ()
       (locals (c.1)
         (begin
           (set! rax 5)
           (set! c.1 10)
           (if (< rax c.1) 
               (r15 rbp rax)
               (begin (set! rax c.1) (r15 rbp rax))))))
     (letrec ()
       (locals ()
         (begin
           (set! rax 5)
           (if (< rax 10) (set! rax (* rax 10)) (nop))
           (r15 rbp rax))))
     (letrec ()
       (locals (a.1 b.2)
         (begin
           (set! a.1 5)
           (set! b.2 1)
           (set! b.2 (* b.2 a.1))
           (set! a.1 (- a.1 1))
           (set! b.2 (* b.2 a.1))
           (set! a.1 (- a.1 1))
           (set! b.2 (* b.2 a.1))
           (set! a.1 (- a.1 1))
           (set! b.2 (* b.2 a.1))
           (set! rax b.2)
           (r15 rbp rax))))
     (letrec ()
       (locals (n.1 a.2)
         (begin
           (set! n.1 5)
           (begin
             (set! a.2 1)
             (begin
               (set! a.2 (* a.2 n.1))
               (begin
                 (set! n.1 (- n.1 1))
                 (begin
                   (set! a.2 (* a.2 n.1))
                   (begin
                     (set! n.1 (- n.1 1))
                     (begin
                       (set! a.2 (* a.2 n.1))
                       (begin
                         (set! n.1 (- n.1 1))
                         (begin
                           (set! a.2 (* a.2 n.1))
                           (begin (set! rax a.2) (r15 rbp rax)))))))))))))
     (letrec ([double$0 (lambda ()
                          (locals ()
                            (begin (set! rax (+ rax rax)) (r15 rbp rax))))])
       (locals () (begin (set! rax 10) (double$0 rax rbp r15))))
     (letrec ([double$1 (lambda ()
                          (locals (x.1)
                            (begin
                              (set! x.1 fv0)
                              (set! x.1 (* x.1 2))
                              (set! fv0 x.1)
                              (set! rax fv0)
                              (r15 rbp rax))))])
       (locals () 
         (begin (set! fv0 5) (double$1 fv0 r15 rbp))))
     (letrec ()
       (locals (x.5) 
         (begin (set! x.5 5) (set! rax x.5) (r15 rbp rax))))
     (letrec ()
       (locals (x.5 y.6)
         (begin
           (set! x.5 5)
           (set! y.6 6)
           (set! x.5 (+ x.5 y.6))
           (set! rax x.5)
           (r15 rbp rax))))
     (letrec ([div$0 (lambda ()
                       (locals ()
                         (begin 
                           (set! fv2 (sra fv2 1)) 
                           (div$1 fv2 fv0 rbp))))]
              [div$1 (lambda ()
                       (locals ()
                         (begin 
                           (set! rax fv2) 
                           (fv0 rax rbp))))])
       (locals (label-temp.1)
         (begin
           (set! fv0 r15)
           (set! label-temp.1 div$0)
           (set! fv1 label-temp.1)
           (set! fv2 64)
           (fv1 fv0 fv2 rbp))))
     (letrec ([setbit3$0 (lambda ()
                           (locals ()
                             (begin
                               (set! fv0 (logor fv0 8))
                               (return$1 fv0 fv1 rbp))))]
              [return$1 (lambda ()
                          (locals ()
                            (begin 
                              (set! rax fv0)
                              (fv1 rax rbp))))])
       (locals ()
         (begin (set! fv0 1) (set! fv1 r15) (setbit3$0 fv0 fv1 rbp))))
     (letrec ([zero?$0 (lambda ()
                         (locals (x.5)
                           (begin
                             (set! x.5 0)
                             (set! x.5 (- x.5 rax))
                             (set! x.5 (sra x.5 63))
                             (set! x.5 (logand x.5 1))
                             (set! rdx x.5)
                             (return$1 rbp rdx r15))))]
              [return$1 (lambda ()
                          (locals ()
                            (begin (set! rax rdx) (r15 rbp rax))))])
       (locals () (begin (set! rax 5) (zero?$0 rax rbp r15))))
     (letrec ([sqr-double$0 (lambda ()
                              (locals (z.5)
                                (begin
                                  (set! z.5 rdi)
                                  (set! z.5 (* z.5 z.5))
                                  (set! fv0 z.5)
                                  (double$1 fv0 r15 rbp))))]
              [double$1 (lambda ()
                          (locals (w.4)
                            (begin
                              (set! w.4 fv0)
                              (set! w.4 (+ w.4 fv0))
                              (set! rsi w.4)
                              (return$3 rbp rsi r15))))]
              [return$3 (lambda ()
                          (locals ()
                            (begin 
                              (set! rax rsi) 
                              (r15 rax rbp))))])
       (locals () 
         (begin (set! rdi 5) (sqr-double$0 rdi r15 rbp))))
     ;; test interaction of already assigned frame-vars and
     ;; register allocator
     (letrec ([square$1 (lambda ()
                          (locals (x.1)
                            (begin
                              (set! x.1 fv0)
                              (set! x.1 (* x.1 x.1))
                              (set! rax x.1)
                              (r15 rax rbp))))])
       (locals ()
         (begin
           (set! fv0 7)
           (square$1 rbp r15 fv0))))
     (letrec ([main$1 (lambda ()
                        (locals ()
                          (begin (set! rax 5) (r15 rbp rax))))])
       (locals () (main$1 r15 rbp)))
     (letrec ([if-test$1 (lambda ()
                           (locals (x.5)
                             (begin
                               (if (begin (set! x.5 5) (= x.5 5))
                                   (set! x.5 (+ x.5 10))
                                   (set! x.5 (- x.5 10)))
                               (set! x.5 (* x.5 10))
                               (set! rax x.5)
                               (r15 rbp rax))))])
       (locals () (if-test$1 r15 rbp)))
     (letrec ([if-test$2 (lambda ()
                           (locals (x.5)
                             (begin
                               (if (begin
                                     (set! x.5 7)
                                     (if (< x.5 1) (false) (< x.5 10)))
                                   (set! x.5 (* x.5 2))
                                   (set! x.5 (+ x.5 5)))
                               (set! rax x.5)
                               (r15 rbp rax))))])
       (locals () (if-test$2 r15 rbp)))
     (letrec ([if-test$3 (lambda ()
                           (locals (n.1)
                             (begin
                               (set! n.1 2)
                               (if (if (= n.1 0)
                                       (true)
                                       (if (= n.1 1) (true) (= n.1 2)))
                                   (begin 
                                     (set! n.1 (* n.1 5))
                                     (set! rax n.1)
                                     (r15 rax rbp))
                                   (begin
                                     (set! n.1 (- n.1 5))
                                     (set! rax n.1)
                                     (r15 rax rbp))))))])
       (locals () (if-test$3 r15 rbp)))
     (letrec ([if-test$4 (lambda ()
                           (locals (x.5)
                             (begin
                               (set! x.5 2)
                               (if (if (= x.5 10) (false) (true))
                                   (set! x.5 (+ x.5 10))
                                   (set! x.5 (- x.5 2)))
                               (set! x.5 (* x.5 10))
                               (set! rax x.5)
                               (r15 rbp rax))))])
       (locals () (if-test$4 r15 rbp)))
     (letrec ([if-test$5 (lambda ()
                           (locals (n.1 x.2 y.3)
                             (begin
                               (set! n.1 rdi)
                               (set! x.2 1)
                               (set! y.3 1)
                               (if (= n.1 0)
                                   (set! x.2 (+ x.2 y.3))
                                   (set! y.3 (+ y.3 x.2)))
                               (set! x.2 (+ x.2 n.1))
                               (if (if (= n.1 y.3) (false) (true))
                                   (set! n.1 (+ n.1 x.2))
                                   (set! n.1 (+ n.1 y.3)))
                               (set! x.2 n.1)
                               (set! rax x.2)
                               (r15 rax rbp))))])
       (locals ()
         (begin (set! rdi 1) (if-test$5 rbp rdi r15))))
     (letrec ([if-test$6 (lambda ()
                           (locals (n.1 x.2 y.3)
                             (begin
                               (set! n.1 rdi)
                               (set! x.2 1)
                               (begin
                                 (set! y.3 1)
                                 (if (= n.1 0)
                                     (set! x.2 (+ x.2 y.3))
                                     (set! y.3 (+ y.3 x.2)))
                                 (set! x.2 (+ x.2 n.1)))
                               (if (if (= n.1 y.3) (false) (true))
                                   (set! n.1 (+ n.1 x.2))
                                   (set! n.1 (+ n.1 y.3)))
                               (set! x.2 (+ x.2 n.1))
                               (set! rax x.2)
                               (r15 rax rbp))))])
       (locals ()
         (begin (set! rdi 1) (if-test$6 rdi r15 rbp))))
     (letrec ()
       (locals (x.1 y.2 z.3)
         (begin
           (set! x.1 0)
           (set! y.2 1)
           (if (if (= x.1 0) (= y.2 1) (false))
               (set! z.3 5)
               (begin (set! z.3 5) (set! z.3 (+ z.3 z.3))))
           (set! rax z.3)
           (r15 rax rbp))))
     (letrec ()
       (locals (a.1 b.2 c.3)
         (begin
           (set! a.1 0)
           (set! b.2 0)
           (if (if (= a.1 0) (= b.2 1) (false))
               (set! c.3 5)
               (begin (set! c.3 5) (set! c.3 (+ c.3 c.3))))
           (set! rax c.3)
           (r15 rax rbp))))
     (letrec ()
       (locals (a.1 b.2)
         (begin
           (set! a.1 0)
           (set! b.2 2)
           (if (= a.1 0)
               (if (= b.2 2) (set! rax b.2) (set! rax 5))
               (set! rax 7))
           (r15 rax rbp))))
     (letrec ()
       (locals (a.1 b.2 c.3)
         (begin
           (set! a.1 0)
           (set! b.2 0)
           (if (if (= a.1 1) (true) (= b.2 1))
               (set! c.3 1)
               (set! c.3 0))
           (set! rax c.3)
           (r15 rax rbp))))
     (letrec ()
       (locals (x.1 y.2 z.3)
         (begin
           (set! x.1 1)
           (set! y.2 0)
           (if (if (= x.1 1) (true) (= y.2 1))
               (set! z.3 1)
               (set! z.3 0))
           (set! rax z.3)
           (r15 rax rbp))))
     (letrec ()
       (locals (a.1 b.2 c.3)
         (begin
           (set! a.1 0)
           (set! b.2 1)
           (if (if (= a.1 1) (true) (= b.2 1))
               (set! c.3 1)
               (set! c.3 0))
           (set! rax c.3)
           (r15 rax rbp))))
     (letrec ()
       (locals (a.1 b.2)
         (begin
           (set! a.1 0)
           (set! b.2 1)
           (if (if (= a.1 1) (= b.2 1) (true))
               (set! a.1 1)
               (set! b.2 0))
           (set! b.2 (* b.2 10))
           (set! a.1 (+ a.1 b.2))
           (set! rax a.1)
           (r15 rax rbp))))
     (letrec ()
       (locals (a.1 b.2)
         (begin
           (set! a.1 1)
           (set! b.2 0)
           (if (if (= a.1 1) (= b.2 1) (true))
               (set! rax 1)
               (set! rax 0))
           (r15 rax rbp))))
     (letrec ()
       (locals (a.1 b.2)
         (begin
           (set! a.1 0)
           (set! b.2 0)
           (if (if (= a.1 1) (= b.2 1) (true))
               (set! rax 1)
               (set! rax 0))
           (r15 rbp rax))))
     (letrec ()
       (locals (a.1 b.2)
         (begin
           (set! a.1 1)
           (set! b.2 1)
           (if (if (= a.1 1) (= b.2 1) (true))
               (set! rax 1)
               (set! rax 0))
           (r15 rbp rax))))
     (letrec ()
       (locals (n.1 a.2 b.3 c.4)
         (begin
           (set! n.1 1)
           (begin
             (set! a.2 2)
             (begin
               (set! b.3 3)
               (begin
                 (set! c.4 n.1)
                 (set! c.4 (+ c.4 b.3))
                 (if (= c.4 b.3)
                     (begin (set! c.4 5))
                     (begin (set! c.4 10)))
                 (set! n.1 (+ n.1 c.4)))
               (set! n.1 (+ n.1 b.3)))
             (set! n.1 (+ n.1 a.2)))
           (set! n.1 (+ n.1 n.1))
           (set! rax n.1)
           (r15 rax rbp))))
     (letrec ([fact$0 (lambda ()
                        (locals ()
                          (begin 
                            (set! rbx 1)
                            (fact$1 rax rbx rbp r15))))]
              [fact$1 (lambda ()
                        (locals (n.1 a.2)
                          (begin
                            (set! n.1 rax)
                            (set! a.2 rbx)
                            (if (= n.1 0)
                                (begin 
                                  (set! rax a.2) (r15 rbp rax))
                                (begin
                                  (set! a.2 (* a.2 n.1))
                                  (set! n.1 (- n.1 1))
                                  (set! rax n.1)
                                  (set! rbx a.2)
                                  (fact$1 rax rbp rbx r15))))))])
       (locals ()
         (begin (set! rax 10) (fact$0 rax rbp r15))))
     (letrec ([fib$0 (lambda ()
                       (locals ()
                         (begin 
                           (set! rbx 0)
                           (set! rcx 1)
                           (fib$1 fv0 rax rbx rcx rbp))))]
              [fib$1 (lambda ()
                       (locals (n.1 a.2 b.3 t.4)
                         (begin
                           (set! n.1 rax)
                           (set! a.2 rbx)
                           (set! b.3 rcx)
                           (if (= n.1 0)
                               (begin (set! rax a.2) (fv0 rbp rax))
                               (begin
                                 (set! n.1 (- n.1 1))
                                 (set! t.4 a.2)
                                 (set! a.2 b.3)
                                 (set! b.3 (+ b.3 t.4))
                                 (set! rax n.1)
                                 (set! rbx a.2)
                                 (set! rcx b.3)
                                 (fib$1 fv0 rax rbx rcx rbp))))))])
       (locals ()
         (begin 
           (set! fv0 r15) 
           (set! rax 5)
           (fib$0 fv0 rax rbp))))
     (letrec ()
       (locals (a.1 b.2 c.3 d.4 e.5)
         (begin
           (set! a.1 1)
           (set! b.2 2)
           (set! c.3 3)
           (set! d.4 4)
           (set! e.5 5)
           (set! e.5 (+ e.5 d.4))
           (set! e.5 (+ e.5 c.3))
           (set! e.5 (+ e.5 b.2))
           (set! e.5 (+ e.5 a.1))
           (set! rax e.5)
           (r15 rax rbp))))

     (letrec ()
       (locals (a.1 b.2 c.3 d.4 e.5 f.6)
         (begin
           (set! a.1 1)
           (set! b.2 2)
           (set! c.3 3)
           (set! d.4 4)
           (set! e.5 5)
           (set! f.6 6)
           (if (begin (set! a.1 (+ a.1 d.4)) (> a.1 f.6))
               (begin
                 (set! c.3 (+ c.3 f.6))
                 (set! a.1 (* a.1 c.3)))
               (begin
                 (set! b.2 (+ b.2 e.5))
                 (set! a.1 (* a.1 b.2))))
           (set! rax a.1)
           (r15 rbp rax))))
     (letrec ([dot$1 (lambda ()
                       (locals (a.1 b.2 c.3 d.4 x.5 y.6 z.7 w.8 acc.9
                                t.10 t.11 t.12 t.13)
                         (begin
                           (set! a.1 fv0)
                           (set! b.2 fv1)
                           (set! c.3 fv2)
                           (set! d.4 fv3)
                           (set! x.5 fv4)
                           (set! y.6 fv5)
                           (set! z.7 fv6)
                           (set! w.8 fv7)
                           (set! acc.9 0)
                           (set! t.10 a.1)
                           (set! t.10 (* t.10 x.5))
                           (set! t.11 b.2)
                           (set! t.11 (* t.11 y.6))
                           (set! t.12 c.3)
                           (set! t.12 (* t.12 z.7))
                           (set! t.13 d.4)
                           (set! t.13 (* t.13 w.8))
                           (set! acc.9 (+ acc.9 t.10))
                           (set! acc.9 (+ acc.9 t.11))
                           (set! acc.9 (+ acc.9 t.12))
                           (set! acc.9 (+ acc.9 t.13))
                           (set! rax acc.9)
                           (r15 rbp rax))))])
       (locals ()
         (begin
           (set! fv0 10)
           (set! fv1 5)
           (set! fv2 16)
           (set! fv3 20)
           (set! fv4 4)
           (set! fv5 11)
           (set! fv6 19)
           (set! fv7 21)
           (dot$1 rax rbp fv0 fv1 fv2 fv3 fv4 fv5 fv6 fv7))))
     
    ;; stress the register allocator, but not so much that it needs to spill.
     (letrec ()
      (locals (a.1 b.2 c.3 d.4 e.5 f.6 g.7 h.8 i.9 j.10 k.11 l.12 m.13 n.14 
               o.15 p.16 q.17 r.18 s.19 t.20 u.21 v.22 w.23 x.24 y.25 z.26)
        (begin
          (set! a.1 1)
          (set! b.2 2)
          (set! c.3 3)
          (set! d.4 4)
          (set! e.5 5)
          (set! f.6 6)
          (set! g.7 7)
          (set! h.8 8)
          (set! i.9 9)
          (set! j.10 10)
          (set! k.11 11)
          (set! l.12 12)
          (set! m.13 13)
          (set! a.1 (+ a.1 b.2))
          (set! a.1 (+ a.1 c.3))
          (set! a.1 (+ a.1 d.4))
          (set! a.1 (+ a.1 e.5))
          (set! a.1 (+ a.1 f.6))
          (set! a.1 (+ a.1 g.7))
          (set! a.1 (+ a.1 h.8))
          (set! a.1 (+ a.1 i.9))
          (set! a.1 (+ a.1 j.10))
          (set! a.1 (+ a.1 k.11))
          (set! a.1 (+ a.1 l.12))
          (set! a.1 (+ a.1 m.13))
          (set! n.14 14)
          (set! o.15 15)
          (set! p.16 16)
          (set! q.17 17)
          (set! r.18 18)
          (set! s.19 19)
          (set! t.20 20)
          (set! u.21 21)
          (set! v.22 22)
          (set! w.23 23)
          (set! x.24 24)
          (set! y.25 25)
          (set! a.1 (+ a.1 n.14))
          (set! a.1 (+ a.1 o.15))
          (set! a.1 (+ a.1 p.16))
          (set! a.1 (+ a.1 q.17))
          (set! a.1 (+ a.1 r.18))
          (set! a.1 (+ a.1 s.19))
          (set! a.1 (+ a.1 t.20))
          (set! a.1 (+ a.1 u.21))
          (set! a.1 (+ a.1 v.22))
          (set! a.1 (+ a.1 w.23))
          (set! a.1 (+ a.1 x.24))
          (set! a.1 (+ a.1 y.25))
          (set! z.26 26)
          (set! b.2 27)
          (set! c.3 28)
          (set! d.4 29)
          (set! e.5 30)
          (set! f.6 31)
          (set! g.7 32)
          (set! h.8 33)
          (set! i.9 34)
          (set! j.10 35)
          (set! k.11 36)
          (set! l.12 37)
          (set! a.1 (+ a.1 z.26))
          (set! a.1 (+ a.1 b.2))
          (set! a.1 (+ a.1 c.3))
          (set! a.1 (+ a.1 d.4))
          (set! a.1 (+ a.1 e.5))
          (set! a.1 (+ a.1 f.6))
          (set! a.1 (+ a.1 g.7))
          (set! a.1 (+ a.1 h.8))
          (set! a.1 (+ a.1 i.9))
          (set! a.1 (+ a.1 j.10))
          (set! a.1 (+ a.1 k.11))
          (set! a.1 (+ a.1 l.12))
          (set! rax a.1)
          (r15 rax rbp))))

    ;; another stress test, which should fail unless low-degree
    ;; nodes are chosen properly
     (letrec ()
       (locals (b.2 g.7 c.3 d.4 e.5 a.1 f.6)
         (begin
           (set! a.1 1)
           (set! b.2 2)
           (set! c.3 a.1)
           (set! d.4 4)
           (set! e.5 5)
           (set! f.6 b.2)
           (set! f.6 (+ f.6 c.3))
           (set! f.6 (+ f.6 d.4))
           (set! f.6 (+ f.6 e.5))
           (set! g.7 7)
           (set! f.6 (+ f.6 g.7))
           (set! rax f.6)
           (r15 rax rcx rdx rbx rbp rsi rdi r8 r9 r10 r10 r11))))
     
    ;; variant of latter that should screw up if the call live
    ;; sets aren't fully accounted for
     (letrec ([f$8 (lambda ()
                     (locals (b.2 g.7 c.3 d.4 e.5 a.1 f.6)
                       (begin
                         (set! a.1 1)
                         (set! b.2 2)
                         (set! c.3 a.1)
                         (set! d.4 4)
                         (set! e.5 5)
                         (set! f.6 b.2)
                         (set! f.6 (+ f.6 c.3))
                         (set! f.6 (+ f.6 d.4))
                         (set! f.6 (+ f.6 e.5))
                         (set! g.7 7)
                         (set! f.6 (+ f.6 g.7))
                         (set! rax f.6)
                         (r15 rax rcx rdx rbx rbp rsi rdi r8 r9 r10 r10 r11))))]
              [g$9 (lambda ()
                     (locals ()
                       (begin
                         (set! rax (+ rax rdx))
                         (set! rax (+ rax rbx))
                         (set! rax (+ rax rbx))
                         (set! rax (+ rax rbp))
                         (set! rax (+ rax rsi))
                         (set! rax (+ rax rdi))
                         (set! rax (+ rax r8))
                         (set! rax (+ rax r9))
                         (set! rax (+ rax r10))
                         (set! rax (+ rax r11))
                         (rcx rbp rax))))])
       (locals ()
         (begin
           (set! rcx r15)
           (set! r15 g$9)
           (set! rdx -11)
           (set! rbx -11)
           (set! rbp -11)
           (set! rsi -11)
           (set! rdi -11)
           (set! r8 -11)
           (set! r9 -11)
           (set! r10 -11)
           (set! r11 -11)
           (f$8 rcx r15 rdx rbx rbp rsi rdi r8 r9 r10 r11))))

    ;; another variant of latter with frame variable references
     (letrec ()
       (locals (b.2 g.7 c.3 d.4 e.5 a.1 f.6)
         (begin
           (set! fv0 77)
           (set! fv1 88)
           (set! fv2 99)
           (set! fv3 111)
           (set! a.1 1)
           (set! b.2 2)
           (set! c.3 a.1)
           (set! d.4 4)
           (set! e.5 5)
           (set! f.6 b.2)
           (set! f.6 (+ f.6 c.3))
           (set! f.6 (+ f.6 d.4))
           (set! f.6 (+ f.6 e.5))
           (set! g.7 7)
           (set! f.6 (+ f.6 g.7))
           (set! f.6 (+ f.6 fv1))
           (set! f.6 (+ f.6 fv2))
           (set! f.6 (+ f.6 fv3))
           (set! rax (+ f.6 fv0))
           (r15 rax rcx rdx rbx rbp rsi rdi r8 r9 r10 r10 r11))))
     
    ;; The following makes a.1 of high degree and since no variable
    ;; can be spilled causes an error in the register allocator
    (letrec ()
      (locals (a.1 b.2 c.3 d.4 e.5 f.6 g.7 h.8 i.9 j.10 k.11 l.12 m.13 n.14 
               o.15 p.16 q.17 r.18 s.19 t.20 u.21 v.22 w.23 x.24 y.25 z.26)
        (begin
          (set! a.1 1)
          (set! b.2 2)
          (set! c.3 3)
          (set! d.4 4)
          (set! e.5 5)
          (set! f.6 6)
          (set! g.7 7)
          (set! h.8 8)
          (set! i.9 9)
          (set! j.10 10)
          (set! k.11 11)
          (set! l.12 12)
          (set! m.13 13)
          (set! n.14 14)
          (set! a.1 (+ a.1 b.2))
          (set! a.1 (+ a.1 c.3))
          (set! a.1 (+ a.1 d.4))
          (set! a.1 (+ a.1 e.5))
          (set! a.1 (+ a.1 f.6))
          (set! a.1 (+ a.1 g.7))
          (set! a.1 (+ a.1 h.8))
          (set! a.1 (+ a.1 i.9))
          (set! a.1 (+ a.1 j.10))
          (set! a.1 (+ a.1 k.11))
          (set! a.1 (+ a.1 l.12))
          (set! a.1 (+ a.1 m.13))
          (set! a.1 (+ a.1 n.14))
          (set! o.15 15)
          (set! p.16 16)
          (set! q.17 17)
          (set! r.18 18)
          (set! s.19 19)
          (set! t.20 20)
          (set! u.21 21)
          (set! v.22 22)
          (set! w.23 23)
          (set! x.24 24)
          (set! y.25 25)
          (set! z.26 26)
          (set! b.2 27)
          (set! a.1 (+ a.1 o.15))
          (set! a.1 (+ a.1 p.16))
          (set! a.1 (+ a.1 q.17))
          (set! a.1 (+ a.1 r.18))
          (set! a.1 (+ a.1 s.19))
          (set! a.1 (+ a.1 t.20))
          (set! a.1 (+ a.1 u.21))
          (set! a.1 (+ a.1 v.22))
          (set! a.1 (+ a.1 w.23))
          (set! a.1 (+ a.1 x.24))
          (set! a.1 (+ a.1 y.25))
          (set! a.1 (+ a.1 z.26))
          (set! a.1 (+ a.1 b.2))
          (set! c.3 28)
          (set! d.4 29)
          (set! e.5 30)
          (set! f.6 31)
          (set! g.7 32)
          (set! h.8 33)
          (set! i.9 34)
          (set! j.10 35)
          (set! k.11 36)
          (set! l.12 37)
          (set! m.13 38)
          (set! n.14 39)
          (set! o.15 40)
          (set! a.1 (+ a.1 c.3))
          (set! a.1 (+ a.1 d.4))
          (set! a.1 (+ a.1 e.5))
          (set! a.1 (+ a.1 f.6))
          (set! a.1 (+ a.1 g.7))
          (set! a.1 (+ a.1 h.8))
          (set! a.1 (+ a.1 i.9))
          (set! a.1 (+ a.1 j.10))
          (set! a.1 (+ a.1 k.11))
          (set! a.1 (+ a.1 l.12))
          (set! a.1 (+ a.1 m.13))
          (set! a.1 (+ a.1 n.14))
          (set! a.1 (+ a.1 o.15))
          (set! rax a.1)
          (r15 rax rbp)))) 
    (letrec ()
      (locals (a.1)
        (begin
          (set! a.1 10)
          (if (< 7 a.1)
              (set! rax a.1)
              (set! rax (+ a.1 a.1)))
          (r15 rax rbp))))

    ))
